package a5.grammar.interfaces;

import a5.common.OrderedTree;
import a5.common.ProgramCursor;
import a5.common.Token;


/**
 * An interface used to specify that a class is a piece of a {@link a5.grammar.interfaces.Grammar Grammar}.
 * Implementing classes should use the {@link a5.grammar.annotations.Grammar @Grammar} annotation to
 * specify to which grammar(s) it belongs.
 * 
 * @author Jason Campos
 * @version Assignment 5, CS 152 (Programming Paradigms) Fall 2012, Jeffrey Smith
 */
public interface Production {
	/*
	 * (non-javadoc)
	 * Implementation specific method for interpreting program text. 
	 * 
	 * TODO Define a class which will allow interpret(Environment, Cursor) to be a part of this interface (Interpretation?)
	 * The problem is that interpret must be flexible in its return type. Some Productions will need to return a String, 
	 * others nothing, and others might need to return a Function. 
	 */
	//public Interpretation interpret(Environment environment, Cursor cursor);
	
	/*
	 * (non-javadoc)
	 * Implementation specific method for parsing program text and returning an ordered structure.
	 */
	public OrderedTree<Token> parse(ProgramCursor cursor);
	
	/*
	 * (non-javadoc)
	 * Implementation specific method for determining whether or not the token at the head of the cursor 
	 * could be a part of Production.
	 */
	public boolean first(ProgramCursor cursor);
}
